/*************************************************************************
*																		 *
*				code by Miles Chen (v-mich) 2007.10.8					 *
*																		 *
*																		 *
*************************************************************************/

#pragma once

#include "commdef-int.h"

namespace System{namespace Windows{namespace Forms{
	namespace KeyboradEvent{

#define IDLE_TIME 100

		void KeyDown(BYTE keyCode)
		{
			keybd_event(keyCode, MapVirtualKeyW(keyCode, 0), NULL, NULL); 
		}

		void KeyUp(BYTE keyCode)
		{
			keybd_event(keyCode, MapVirtualKeyW(keyCode, 0), KEYEVENTF_KEYUP, NULL); 
		}

		void KeyPress(BYTE keyCode)
		{
			KeyDown(keyCode); 
			Sleep(IDLE_TIME); 
			KeyUp(keyCode); 
		}
	}}}}